﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SkynetCE.Foundation.Model;

namespace SkynetCE.Administration.Views.MgmExams
{
    public partial class MgmExamView : Form, IMgmExamView
    {
        private MgmExamPresenter _Presenter;
        public MgmExamPresenter Presenter
        {
            get
            {
                if (_Presenter == null)
                {
                    this._Presenter = new MgmExamPresenter();
                    this._Presenter.View = this;
                }
                return _Presenter;
            }
        }
        public MgmExamView()
        {
            InitializeComponent();
        }


        public List<SkynetCE.Foundation.Model.ExamCategory> Categories
        {
            set {
                this.bsExamCategories.DataSource = value;                  
            }
        }

        public string HelpText
        {
            get { return ""; }
        }

        private void MgmExamView_Load(object sender, EventArgs e)
        {
            this.Presenter.OnViewReady(); 
        }

        private void btnInsert_Click(object sender, EventArgs e)
        {
            var exam = new Exam();
            exam.Id = Guid.NewGuid();
            exam.Title = this.txtTitle.Text;
            exam.Summary = this.txtSummary.Text; 

            this.Presenter.InsertExam(exam); 
        }
    }
}